package com.lxj.lambda;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

import com.lxj.charactor.Hero;

/**
 * TestLambda
 */
public class TestLambda {

    public static void main(String[] args) {
        Random r = new Random();
        List<Hero> heros = new ArrayList<>();

        for (int i = 0; i < 10; i++) {
            heros.add(new Hero("hero_"+i, r.nextInt(1000), r.nextInt(100)));
        }

        // System.out.println(heros);

        filter(heros);
    }


    private static void filter(List<Hero> heros) {
        for (Hero hero : heros) {
            if(hero.hp > 100 && hero.damage < 50) {
                System.out.println(hero.toString());
            }
        }
    }


}